#!/usr/bin/env bash

# note that that bbsh must bootstrap itself so it needs a direct reference
# its own directory
version=$2
source /opt/bbsh/bbsh_${version}/portionlib.sh
#source /opt/bbsh/bbsh_${version}/hostlib.sh

add_package_symlink $1 $2
# Define the first path entry in profile if it does not exist

if [ -z "$(grep portion.path /etc/profile)" ]; then
	
    echo 'source /etc/portion.path' >> /etc/profile
fi

touch /etc/portion.path

if [ -z "$(grep bbsh /etc/portion.path)" ]; then

    echo 'PATH=/opt/bbsh/current:$PATH' >> /etc/portion.path
fi

# touch .keep in /opt to ensure it is not removed
touch /opt/.keep

if [ -z "$(grep portion.env /etc/profile)" ]; then

    echo 'source /etc/portion.env' >> /etc/profile
fi

touch /etc/portion.env


